package uk.co.agileworks.bidpirate.model;

import java.io.Serializable;

import javax.persistence.Entity;
import javax.persistence.Id;

import org.apache.commons.lang.builder.ToStringBuilder;
import org.hibernate.annotations.Type;
import org.joda.time.DateTime;

@Entity
public final class Item implements Serializable {

	private static final long serialVersionUID = 1L;

	@Id
	private Long itemNumber;
	private String description;
	@Type(type = "org.joda.time.contrib.hibernate.PersistentDateTime")
	private DateTime endTime;
	private String currency;
	private double price;
	private String imageUrl;
	private boolean buyItNow;

	public String getCurrency() {
		return currency;
	}

	public String getDescription() {
		return description;
	}

	public DateTime getEndTime() {
		return endTime;
	}

	public String getImageUrl() {
		return imageUrl;
	}

	public Long getItemNumber() {
		return itemNumber;
	}

	public double getPrice() {
		return price;
	}

	public boolean isBuyItNow() {
		return buyItNow;
	}

	public void setBuyItNow(boolean buyItNow) {
		this.buyItNow = buyItNow;
	}

	public void setCurrency(String currency) {
		this.currency = currency;
	}

	public void setCurrencyAndPrice(CurrencyAndPrice currencyAndPrice) {
		setCurrency(currencyAndPrice.getCurrency());
		setPrice(currencyAndPrice.getPrice());
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public void setEndTime(DateTime endTime) {
		this.endTime = endTime;
	}

	public void setImageUrl(String imageUrl) {
		this.imageUrl = imageUrl;
	}

	public void setItemNumber(Long itemNumber) {
		this.itemNumber = itemNumber;
	}

	public void setPrice(double price) {
		this.price = price;
	}

	@Override
	public String toString() {
		return ToStringBuilder.reflectionToString(this);
	}
}
